var Page = function(){
    this.init();
};
Page.prototype = {
    params: {
        passport: '',
    },
    init: function(){
        this.initParams();
        this.initEvent();
    },
    initParams: function(){
        this.params.passport = Pub.getCookie('_PASSPORT');
    },
    getData: function(){
        var _this = this;
        var paramsObj = {
            passport: _this.params.passport
        };
        Api.newnumericallist(paramsObj, function(data){
            console.log(data);
            _this.getDataList(data.data);

        });
    },
    getDataList: function(data) {
        var _this = this;
        if (data && data.length > 0) {
            var html = '',
                i = 0,
                len = data.length;
            for (i; i < len; i++) {
                html +='<tr>';
                // if (data[i].sysId==1) {
                //     html +='<td class="text-c">提现手续费百分比 </td>';
                // }else if(data[i].sysId==2){
                //     html +='<td class="text-c">提现手续费固定值 </td>';
                // }else if(data[i].sysId==3){
                //     html +='<td class="text-c">账单还款日 </td>';
                // };
                html +='<td class="text-c">'+data[i].keyName+' </td>'+
                    '<td class="text-c">'+data[i].describe+'</td>'+
                    '<td class="text-c">'+data[i].value+'</td>'+
                    '<td class="text-c">'+
                        '<a class="handle edit" sysId="'+data[i].sysId+'" href="./numerical-set-edit.html">编辑</a>'+
                    '</td>'+
                '</tr>';
            }
            $('#List').html(html);
            _this.clickEvent()
        } else {
            var html = '<tr>' +
                '<td class="text-c c-666" colspan="4" >暂无数据</td>' +
                '</tr>';
            $('#List').html(html);
        }

    },
    clickEvent:function(){
        var _this = this;
        $('.edit').on('click', function() {
            Pub.setSession('sysId', $(this).attr('sysId'));
            window.location.href = Pub.getHtmlUrl('./numerical-set-edit.html');
        });
    },
    otherEvent:function(){
        var _this = this;
        $('.goods-checkbox input').iCheck({
            checkboxClass: 'icheckbox-blue',
            radioClass: 'iradio-blue',
            increaseArea: '20%'
        })
    },
    initEvent: function(){
        var _this = this;
         _this.getData();
        _this.otherEvent();
        _this.clickEvent();


    }
};
var page = new Page();